<template>
<div>
        <p>姓名:{{this.$store.state.username}}</p>
        <p>性别:{{this.$store.state.sex}}</p>
        <p>婚否:{{this.$store.state.married?'已婚':'未婚'}}</p>
        <p>学校:{{this.$store.state.school.name}}</p>
        <p>爱好:{{this.$store.state.hobby[0]}}</p>
        <button @click="doClick">切换婚姻状态</button>
        <button @click="doClick2">离婚</button>
    </div>
</template>
<script>
export default {
    methods:{
        doClick2(){
            this.$store.commit('updateMarriedState',false)
        },
        doClick(){
            //调用commit,提交mutations
            this.$store.commit('updateMarriedState')
        }
    }
}
</script>